const workLoop = (deadline) => {
  let shouldYield = false
  while (!shouldYield) {
    // run task
    shouldYield = deadline.timeRemaining() < 1
  }
  requestIdleCallback(workLoop)
}
requestIdleCallback(WorkLoop)
